package com.gamejelly.broker.processor.event;

import com.alipay.remoting.Connection;
import com.alipay.remoting.ConnectionEventProcessor;
import com.gamejelly.broker.server.BrokerServer;
import com.gamejelly.broker.server.BrokerServerAware;

public class DisconnectHandler implements ConnectionEventProcessor, BrokerServerAware {

    BrokerServer server;

    @Override
    public void onEvent(String s, Connection connection) {
        String id = (String) connection.getAttribute("id");
        server.unRegister(id);
    }

    @Override
    public void setServer(BrokerServer server) {
        this.server = server;
    }
}
